package lianxi3;

public class Teacher extends People {
    private String subject;
    public Teacher(String name,  String subject) {
        super(name);
        this.subject = subject;
    }

    public Teacher() {
    }

    public Teacher(String subject) {
        this.subject = subject;
    }

    public void teach() {
        System.out.println(getName() + " is teaching " + subject);
    }


    /**
     * 获取
     * @return subject
     */
    public String getSubject() {
        return subject;
    }

    /**
     * 设置
     * @param subject
     */
    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String toString() {
        return "Teacher{subject = " + subject + "}";
    }
    @Override
    public void doing(){
        System.out.println(getName()+" 正在教 " + subject);
    }
}
